package Object.fanxi;

/**
 * @author haomin
 * @date 2022/11/08 21:30
 **/
public class Test {
    public static void main(String[] args) {
        IMessage<String> message = new MessageImpl1<String>();
        message.printMsg("123");
        IMessage message1 = new MessageImpl2();
        message1.printMsg(123);
    }
}

interface IMessage<T> {
    // 泛型方法
    <T> void printMsg(T t);
}

class MessageImpl1<T> implements IMessage<T> {

    @Override
    public <T1> void printMsg(T1 t1) {
        System.out.println(t1);
        System.out.println("是泛型类");
    }
}

class MessageImpl2<Integer> implements IMessage<Integer> {

    @Override
    public <T> void printMsg(T t) {
        System.out.println(t);
        System.out.println("是普通类");
    }
}